import { request } from '@/utils/request.util';
import type { Res, ResNull } from '@/types/common';
import type { Root, DeptListRoot } from '@/types/root';

/**
 * 查询患者列表
 * @param params 查询参数
 */
export const getMedicalList = (params?: any) =>
  request.get<Res<any>>('/clinic/medical/getMedicalList', { params });

/**
 * 门诊：查询患者就诊历史
 * @param params 
 */
export const getRecordList = (params?: any) =>
  request.get<Res<any>>('/clinic/medical/getRecordList', { params });


/** * 门诊：查询病历详情
 * @param params 
 */
export const getMedicalDetail = (params?: any) =>
  request.get<Res<any>>('/clinic/medical/getMedicalDetail', { params });

/**
 * 叫号：获取门诊叫号看板
 * @param params 
 */
export const getCallNumberBoard = (params?: any) =>
  request.get<Res<any>>('/clinic/queue/getBoardList', { params });

/**
 * 门诊：暂停接诊
 * @param params 
 */
export const pauseMedical = () =>
  request.post<ResNull>('/project/fee/stopReception');  


/**
 * 门诊：恢复接诊
 * @param params 
 */
export const resumeMedical = () =>
  request.post<ResNull>('/project/fee/resumeReception');

/**
 * 门诊：获取医生的停诊状态
 * @param params 
 */
export const getDoctorMedicalStatus = () =>
  request.get<ResNull>('/project/fee/getDoctorMedicalStatus');

/**
 * 门诊：查询患者就诊历史 （用medicalid字段获取病历详情）
 * @param params 
 */
export const getDeptList = (params?: any) =>
  request.get<Res<DeptListRoot>>('/clinic/medical/getRecordList', { params });


/**
 * 随访：查询随访列表
 * @param params 
 */
export const getFollowupList = (params?: any) =>
  request.get<Res<any>>('/clinic/followup/getFollowupList', { params });

/**
 * 随访：查询随访详情
 * @param params 
 */
export const getFollowupDetail = (params?: any) =>
  request.get<Res<any>>('/clinic/followup/getFollowupDetail', { params });
/**
 * 随访：完成随访
 * @param data
 */
export const completeFollowup = (data: any) =>
  request.post<ResNull>('/clinic/followup/completeFollowup', data);


/**
 * 随访：查询患者随访历史
 * @param params 
 */
export const getFollowupRecordList = (params?: any) =>
  request.get<Res<any>>('/clinic/followup/getRecordList', { params });

/**
 * 叫号：获取候诊列表
 * @param params 
 */
export const getWaitingList = () =>
  request.get<Res<any>>('/clinic/queue/getReadyList');

/**
 * 叫号：获取待诊列表
 * @param params 
 */
export const getToBeSeenList = () =>
  request.get<Res<any>>('/clinic/queue/getWaitingList');

/**
 * 叫号：获取完诊列表
 * @param params 
 */
export const getSeenList = () =>
  request.get<Res<any>>('/clinic/queue/getTreatedList');

/**
 * 叫号：呼叫下一位
 * @param params 
 */
export const callNext = (data: any) =>
  request.post<ResNull>('/clinic/queue/callNext', data);


/**
 * 叫号：过号
 * @param params 
 */
export const postMissed = (data: any) =>
  request.post<ResNull>('/clinic/queue/missed', data);

/**
 * 叫号：重新排队
 * @param params 
 */
export const repeatWait = (data: any) =>
  request.post<ResNull>('/clinic/queue/repeatWait', data);


/**
 * 叫号：重新呼叫
 * @param params 
 */
export const repeatCall = (data: any) =>
  request.post<ResNull>('/clinic/queue/repeatCall', data);

/**
 * 门诊：完成预诊
 * @param params 
 */
export const completePreDiagnosis = (data: any) =>
  request.post<ResNull>('/clinic/medical/confirmPre', data);

/**
 * 门诊：完成问诊
 * @param params 
 */
export const completeInquiry = (data: any) =>
  request.post<ResNull>('/clinic/medical/completed', data);


/**
 * 门诊：药品冲突验证-完成诊断按钮之前调用
 * @param params 
 */
export const drugConflictCheck = (data: any) =>
  request.post<Res<any>>('/clinic/medical/verify', data);

/**
 * 获取医生当日挂号统计
 * @param params 
 */
export const getDoctorList = (params?: any) =>
  request.get<Res<any>>('/clinic/register/getDoctorList', { params });

/**
 * 门诊:查询药库列表
 * @param params 
 * 
 */
export const getStorageSelectList = () =>
  request.get<Res<any>>('/stock/supply/getStorageSelectList');

/**
 * 检查：查询患者历史的检查单
 * @param params 
 */

export const getCheckRecordList = (params?: any) =>
  request.get<Res<any>>('/order/exam/getOrderExamHistoryList', { params });


/**
 * 门诊：查询患者就诊历史数
 * @param params 
 */
export const getPatientHistoryCount = (params?: any) =>
  request.get<Res<any>>('/clinic/medical/getRecordCount', { params });

/**
 * 查询患者历史的检查单数量
 * @param params 
 */

export const getPatientList = (params?: any) =>
  request.get<Res<any>>('/order/exam/getOrderExamHistoryCount', { params });

/**
 * 门诊：修改病历
 * @param params 
 */
export const updateMedicalRecord = (data: any) =>
  request.post<ResNull>('/clinic/medical/editMedical', data);

/**
 * 叫号：获取呼叫中的患者
 * @param params 
 */
export const getCallingPatient = () =>
  request.get<Res<any>>('/clinic/queue/getCalled');

/**
 * 打印：病历
 * @param params 
 */
export const printMedicalRecord = (params?: any) =>
  request.get<Res<any>>('/clinic/medical/getClinicMedicalPrint', { params });

/**
 * 打印：处方单
 * @param params 
 */
export const printPrescription = (params?: any) =>
  request.get<Res<any>>('/clinic/medical/getClinicRxPrint', { params });

/**
 * 打印：检查单
 * @param params 
 */
export const printExam = (params?: any) =>
  request.get<Res<any>>('/clinic/medical/getClinicExamPrint', { params });